package com.shortlink.admin.remote;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shortlink.admin.remote.dto.shortlinkmapper.ShortLinkReqDTO;
import com.shortlink.admin.remote.dto.shortlinkstats.*;
import com.shortlink.common.base.BasePageReqDTO;
import com.shortlink.common.base.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 短链接中台远程调用服务
 *
 * @author wp
 */
@FeignClient(
        name = "${shortlink-aggregation.name:shortlink-core}",
        path = "/${shortlink-aggregation.name:shortlink-core}",
        contextId = "shortLinkStats"
)
public interface ShortLinkStatsRemoteService {
    /**
     * 批量获取基础监控数据
     */
    @PostMapping("/api/stats/shortlink/base/today/batch")
    Result<List<ShortLinkTodayBaseStatsRespDTO>> batchGetTodayShortLinkBaseStats(@RequestBody List<ShortLinkReqDTO> shortLinks);

    /**
     * 访问单个短链接指定时间内监控数据
     */
    @GetMapping("/api/stats/shortlink/info")
    Result<ShortLinkStatsVO> signalShortLinkStats(@SpringQueryMap SignalShortLinkStatsReqDTO signalShortLinkStats);

    /**
     * 访问单个短链接指定时间内监控访问记录数据
     */
    @GetMapping("/api/stats/shortlink/record")
    Result<Page<ShortLinkStatsRecordVO>> signalShortLinkStatsRecord(@SpringQueryMap SignalShortLinkStatsReqDTO signalShortLinkStats,
                                                                    @SpringQueryMap BasePageReqDTO page);

    /**
     * 访问批量短链接指定时间内监控数据
     */
    @PostMapping("/api/stats/shortlink/info/batch")
    Result<ShortLinkStatsVO> batchShortLinkStats(@RequestBody BatchShortLinkStatsReqDTO batchShortLinkStats);



    /**
     * 访问批量短链接指定时间内监控访问记录数据
     */
    @PostMapping("/api/stats/shortlink/record/batch")
    Result<Page<ShortLinkStatsRecordVO>> batchShortLinkStatsRecord(@RequestBody BatchShortLinkStatsReqDTO batchShortLinkStats,
                                                                   @SpringQueryMap BasePageReqDTO page);
}
